<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <!-- import CSS -->
    <link rel="stylesheet" href="https://cdn.staticfile.org/element-ui/2.15.9/theme-chalk/index.css">
</head>
<style>
    body{
        background-image: url("imgs/bkg.jpg");
        margin: 0;
        background-size: cover;
        background-repeat: no-repeat;
        text-align: center;
    }
    .el-form-item__label{
        color: black;
        font-weight: bold;
    }
</style>
<body>
<div id="app">
    <h1 style="color: white;font-size: 72px;margin-bottom: 0" >酒店后台管理员登录页面</h1>
    <img src="imgs/logo2.png" style="width: 93px;height: 70px;margin: 0">
    <h2 style="color: white;font-size: 32px;margin-bottom: 0">xxx酒店后台管理页面</h2>
    <el-card style="width: 600px;height: 300px;margin: 0 auto;background-color: rgba(255,255,255,0.3)">
        <el-form label-width="60px" style="width: 450px;margin: 50px auto;">
            <el-form-item  label="工号">
                    <el-input type="text" v-model="emp.empNum" placeholder="请输入工号"></el-input>>
            </el-form-item>
            <el-form-item label="密码" >
                <el-input type="password" v-model="emp.password" placeholder="请输入密码"></el-input>>
            </el-form-item>
            <el-form-item>
                <el-button style="position: relative;right: 30px;bottom: 30px" type="primary" @click="login()">
                    登录
                </el-button>
            </el-form-item>
        </el-form>
    </el-card>
</div>
</body>
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.min.js"></script>
<!-- import Vue before Element -->
<script src="https://cdn.staticfile.org/vue/2.6.14/vue.min.js"></script>
<!-- import JavaScript -->
<script src="https://cdn.staticfile.org/element-ui/2.15.9/index.min.js"></script>
<script>
    let v = new Vue({
        el: '#app',
        data: function() {
            return {
                emp:{empNum:"",password:""}
            }
        },
        methods:{
            login(){
                axios.post("/admins/login",v.emp).then(function (response) {
                    if(response.data.state==20000){
                            alert("登录成功！")
                            location.href="admin.html"
                        }else {
                        alert("账号或密码不正确！")
                    }
                })
            }
        }

    })
</script>
</html>